class LYTranslateModel {
  LYTranslateModel({
    this.detectedLanguage,
    this.translations,
  });

  LYTranslateModel.fromJson(dynamic json) {
    detectedLanguage = json['detectedLanguage'] != null
        ? DetectedLanguage.fromJson(json['detectedLanguage'])
        : null;
    if (json['translations'] != null) {
      translations = [];
      json['translations'].forEach((v) {
        translations?.add(Translations.fromJson(v));
      });
    }
  }
  DetectedLanguage? detectedLanguage;
  List<Translations>? translations;
  LYTranslateModel copyWith({
    DetectedLanguage? detectedLanguage,
    List<Translations>? translations,
  }) =>
      LYTranslateModel(
        detectedLanguage: detectedLanguage ?? this.detectedLanguage,
        translations: translations ?? this.translations,
      );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (detectedLanguage != null) {
      map['detectedLanguage'] = detectedLanguage?.toJson();
    }
    if (translations != null) {
      map['translations'] = translations?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class Translations {
  Translations({
    this.translatedText,
    this.detectedSourceLanguage,
  });

  Translations.fromJson(dynamic json) {
    translatedText = json['translatedText'];
    detectedSourceLanguage = json['detectedSourceLanguage'];
  }
  String? translatedText;
  String? detectedSourceLanguage;
  Translations copyWith({
    String? translatedText,
    String? detectedSourceLanguage,
  }) =>
      Translations(
        translatedText: translatedText ?? this.translatedText,
        detectedSourceLanguage:
            detectedSourceLanguage ?? this.detectedSourceLanguage,
      );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['translatedText'] = translatedText;
    map['detectedSourceLanguage'] = detectedSourceLanguage;
    return map;
  }
}

class DetectedLanguage {
  DetectedLanguage({
    this.language,
    this.score,
  });

  DetectedLanguage.fromJson(dynamic json) {
    language = json['language'];
    score = json['score'];
  }
  String? language;
  num? score;
  DetectedLanguage copyWith({
    String? language,
    num? score,
  }) =>
      DetectedLanguage(
        language: language ?? this.language,
        score: score ?? this.score,
      );
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['language'] = language;
    map['score'] = score;
    return map;
  }
}
